home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Sample Code / Snippets / Development Tools & Languages / Shared Lib. Mgr. C++ / Sources / Process.h < prev    next >
Encoding:
Text File  |  1992-08-30  |  3.1 KB  |  108 lines  |  [TEXT/MPS ]

  1. /* _________________________________________________________________________________________________________ //
  2.   Copyright © 1992 Apple Computer, Inc. All rights reserved.
  3.   Macintosh Developer Technical Support.C++ Macintosh Toolbox Framework.
  4.   Date: Wednesday, June 10, 1992 22:37:24
  5.   Revision comments are at the end of this file.
  6.   ---
  7.   TProcess is a Process Manager class.
  8.   Process.h contains the header file information for the TProcess class construction.
  9.   _________________________________________________________________________________________________________ */
  10.  
  11. // Declare label for this header file
  12. #ifndef _PROCESS_
  13. #define _PROCESS_
  14.  
  15.  
  16. //    Toolbox Include Files
  17. #ifndef __TYPES__
  18. #include <Types.h>
  19. #endif
  20.  
  21. #ifndef __PROCESSES__
  22. #include <Processes.h>
  23. #endif
  24.  
  25. #ifndef __APPLEEVENTS__
  26. #include <AppleEvents.h>
  27. #endif
  28.  
  29. #ifndef __OSUTILS__
  30. #include <OSUtils.h>
  31. #endif
  32.  
  33.  
  34.  
  35. // Global structures
  36.  
  37. ProcessSerialNumber gNullPSN = {
  38.                                 kNoProcess, kNoProcess};
  39.  
  40.  
  41. // SLM definitions
  42. #define kTProcessID "slm:dtsl$TProcess"
  43.  
  44. #ifndef __LIBRARYMANAGERCLASSES__
  45. #include <LibraryManagerClasses.h>
  46. #endif
  47.  
  48.  
  49. // _________________________________________________________________________________________________________ //
  50. //    Class Interface
  51.  
  52. class TProcess : public TDynamic
  53. {
  54.     // The TProcess class…
  55. public:
  56.     //    CONSTRUCTORS & DESTRUCTORS
  57.     TProcess();                                    // default constructors
  58.     virtual~ TProcess();                        // virtual destructor
  59.  
  60.     //  MAIN INTERFACES
  61.     virtual Boolean KillApplication(ProcessSerialNumber*);// quit the application
  62.     virtual short GetNumProcesses();            // get the N amount of currently running procs
  63.     virtual ProcessInfoRec GetProcessInfoRec();    // fetch the whole process info rec
  64.     virtual unsigned long GetProcessSize();        // get the size of the process
  65.     virtual unsigned long GetFreeMem();            // get free memory available for the process
  66.     virtual unsigned long GetLaunchDate();        // get in seconds the launch time
  67.     virtual Boolean FindProcess(OSType signature);// find process with the right signature
  68.  
  69.     //    PUBLIC ACCESSORS AND MUTATORS            
  70.     virtual virtual ProcessSerialNumber GetMyProcessID() const;
  71.     virtual ProcessSerialNumber GetProcessID() const;
  72.  
  73.     // ITERATORS
  74.     virtual void Next();                        // next PSN
  75.     virtual Boolean Last();                        // last PSN?
  76.     virtual void First();                        // reset to first PSN
  77.  
  78.  
  79. protected:
  80.     //    INITIATION ROUTINES                        
  81.     virtual Boolean IProcess();                    // initialize needed class information
  82. public:
  83.     virtual void Initialize(ProcessSerialNumber = gNullPSN);// default constructors
  84.  
  85. private:
  86.     //    FIELDS
  87.     ProcessSerialNumber fProcessID;                // any specific PSN number
  88.     ProcessSerialNumber fMyProcessID;            // our PSN number
  89.     ProcessSerialNumber fFirstPSN;                // the first one we got
  90.     Boolean fFirstTime;                            // signals order of iterators
  91.     Boolean fLast;
  92.     Boolean fState;                                // state of the object
  93. };
  94.  
  95.  
  96. #endif _PROCESS_
  97.  
  98. // _________________________________________________________________________________________________________ //
  99.  
  100.  
  101. /*    Change History (most recent last):
  102.   No        Init.    Date        Comment
  103.   1            khs        6/10/92        New file
  104.   2            khs        7/6/92        First decent working class
  105. */
  106.  
  107.  
  108.